package com.sth.cloud;


import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.io.IOException;
import java.net.InetAddress;

/**
 * @Author: 司天宏
 * @Description:
 * @Date: 2024-04-10 23:26
 */
@EnableDiscoveryClient
@SpringBootApplication
public class NacosConfigClient3377 {

    public static void main(String[] args) throws IOException {
        ConfigurableApplicationContext application = SpringApplication.run(NacosConfigClient3377.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String property = env.getProperty("server.servlet.context-path");
        String path = property == null ? "" : property;
        System.out.println(
                "\n\t" +
                        "----------------------------------------------------------\n\t" +
                        "Application NacosConfigClient3377 is running! Access URLs:\n\t" +
                        "Local: \t\thttp://localhost:" + port + path + "/\n\t" +
                        "External: \thttp://" + ip + ":" + port + path + "/\n\t" +
                        "Swagger3: " + "http://127.0.0.1:" + port + "/swagger-ui/index.html" + "\n\t" +
                        "------------------------------------------------------------");
    }

}
